package com.news.contant;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;

import com.news.activity.ContentDetailActivity;

public class PackageContent {
	private static int fontSize;
	private static int lineHeight;
	
	public static String packingContent(String acontent, int apadding) {
		String content = 
				"<html>" +
						"<head>" +
						"<h2 align=\"center\">"+ ContentDetailActivity.tittle +
								"</h2>" +
								"<h5 align=\"right\">"+ ContentDetailActivity.pubDate +
										"</h5>" +
										"</head>" +
										"<hr>" +
										"<body>" +
										"<font size=\""+fontSize+"px\"  >"+
										"<div style=\"line-height:"+lineHeight+"%\">" + 
										"<div style=\"padding-left:"+apadding+"px;\">" + 
										"<div style=\"padding-right:"+apadding+"px;\">" + 
										"<p>" +
										acontent +
												"</p>" +
												"</font>"+
												"</body>" +
												"</html>";
		return content;
	}
	
	public static void setFont(Context context) {
		DisplayMetrics dm = new DisplayMetrics();
		((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
		System.out.println("screem:" + dm.widthPixels + "x" + dm.heightPixels);
		if (dm.widthPixels <= 320) {
			fontSize = 2;
			lineHeight = 120;
		} else if (dm.widthPixels > 320 && dm.widthPixels <= 480) {
			fontSize = 3;
			lineHeight = 150;
		} else if (dm.widthPixels > 480 && dm.widthPixels <= 800) {
			fontSize = 4;
			lineHeight = 180;
		}

	}
	

}
